package com.yaj.service.impl;

import com.yaj.enums.BasicEnum;
import com.yaj.exception.BaseException;
import com.yaj.pojo.ApprovalRecords;
import com.yaj.mapper.ApprovalRecordsMapper;
import com.yaj.service.IApprovalRecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaj.vo.RecordsVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xiaojiu
 * @since 2024-08-21
 */

@Slf4j
@Service
public class ApprovalRecordsServiceImpl extends ServiceImpl<ApprovalRecordsMapper, ApprovalRecords> implements IApprovalRecordsService {

    @Autowired
    private ApprovalRecordsMapper recordsMapper;

    @Override
    public void insertRecords(ApprovalRecords approvalRecords) {
        int i = baseMapper.insert(approvalRecords);
        if (i < 1) {
            new BaseException(BasicEnum.INSERT_RECORD_FAIL);
        }
    }

    @Override
    public RecordsVo approvalRecords(Long id, Long recordId) {
        return recordsMapper.approvalRecords(id, recordId);
    }
}
